﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace BanquetPortion.Models
{
    /// <summary>
    /// 数据字典模型
    /// </summary>
    [Table("dataDictionary")]
    public class DataDictionary
    {
        /// <summary>
        /// 数据 ID
        /// </summary>
        [Key]
        [Display(Name = "数据 ID")]
        public int Id { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        [Display(Name = "创建人")]
        public int CreatedBy { get; set; }
        /// <summary>
        /// 创建日期
        /// </summary>
        [Display(Name = "创建日期")]
        public DateTime CreatedDataTime { get; set; } = DateTime.UtcNow.AddHours(8);
        /// <summary>
        /// 父级 Id
        /// </summary>
        [Display(Name = "父级 Id")]
        [Required(ErrorMessage ="请输入父级 Id")]
        public int ParentId { get; set; } = 0;
        /// <summary>
        /// 数据字典名称
        /// </summary>
        [Display(Name = "数据字典名称")]
        [Required(ErrorMessage ="数据字典名称是必须的")]
        [MaxLength(50,ErrorMessage ="名称最大长度为 50 个字")]
        public string DataDictionaryName { get; set; }
        /// <summary>
        /// 数据字典的描述
        /// </summary>
        [Display(Name = "数据字典的描述")]
        [Required]
        [MaxLength(200,ErrorMessage ="描述的最大长度为 200 个字")]
        public string Description { get; set; }
        /// <summary>
        /// 数据字典的排序
        /// </summary>
        [Display(Name = "数据字典的排序")]
        [Required]
        public int SortIndex { get; set; } = 0;
    }
}
